package net.chrisrichardson.ec2deployer.core;

/**
This provides access to primarily security related properties
<pre>

# The image to run
imageId.m1.small=ami-6f2cc906
imageId.m1.large=ami-0129cc68
imageId.m1.xlarge=ami-0129cc68

# The various keys etc defined by Amazon Web Services
accessKey=
secretKey=
accountId=
keyPairFile=

# The directory containing the ssh executable, e.g. c:/cygwin/bin
sshDir=
</pre>

*/

public class AWSProperties {

	private Properties properties
	
    public AWSProperties(Properties properties) {
        this.properties = properties
    }

	public AWSProperties(String path) {
        properties = new Properties();
        properties.load(new FileInputStream(path));
	}
	
	public Object getProperty(String name) {
		String value = properties.getProperty(name)
		if (!value)
            throw new RuntimeException( "No value for $name")
        value.trim()
	}
	
	public boolean exists(property) {
	  properties.containsKey(property)
	}
}